package com.ljf.config.infra.repository.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ljf.common.exception.ServiceException;
import com.ljf.common.infra.repository.impl.BasisRepositoryImpl;
import com.ljf.common.utils.CollectionUtil;
import com.ljf.config.domain.repository.ConfigBaseImpulseSenderHeaderRepository;
import com.ljf.config.dto.query.ConfigBaseImpulseSenderHeaderQuery;
import com.ljf.config.infra.mapper.ConfigBaseImpulseSenderHeaderMapper;
import com.ljf.config.model.ConfigBaseImpulseSenderHeader;
import com.ljf.config.vo.ConfigBaseImpulseSenderHeaderVO;
import org.springframework.stereotype.Component;

/**
 * 发号器配置表头  数据访问接口实现
 *
 * @author LJF
 * @since 2025-01-09
 */
@Component
public class ConfigBaseImpulseSenderHeaderRepositoryImpl extends BasisRepositoryImpl<ConfigBaseImpulseSenderHeaderMapper, ConfigBaseImpulseSenderHeader, ConfigBaseImpulseSenderHeaderQuery, ConfigBaseImpulseSenderHeaderVO> implements ConfigBaseImpulseSenderHeaderRepository {

    @Override
    protected QueryWrapper<ConfigBaseImpulseSenderHeader> fillWrapper(ConfigBaseImpulseSenderHeaderQuery query, boolean sort) throws ServiceException {
        QueryWrapper<ConfigBaseImpulseSenderHeader> wrapper = super.fillWrapper(query, sort);
        if (CollectionUtil.isNotEmpty(query.getCodeList())) {
            wrapper.in(ConfigBaseImpulseSenderHeader.COL_CODE, query.getCodeList());
        }
        return wrapper;
    }

}
